<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="Content-Security-Policy" content="upgrade-insecure-requests">
    <script type="text/javascript" src="/lib/haha/core/start.js"></script>
    <script type="text/javascript" src="lib/layDate-v5.0.9/layDate-v5.0.9/laydate/laydate.js"></script>
    <link rel="stylesheet" href="CSS/pageNation.css">
    <link rel="stylesheet" href="CSS/knowledge.css">
</head>

<body>
    <div id="header"></div>
    <!-- 内容 -->
    <div class="container">


        <div class="aside">
            <div class="top" id="asideMenu1qk1">
                <div class="left bg_size">
                    <span>分类导航</span>
                </div>
                <div class="right">
                    <span class="select" id="all">全选</span>
                    <span class="two" id="not">取消</span>
                </div>
            </div>
            <!-- 分类导航栏菜单 -->
            <div class="asideMenu wwwx" id='asideMenu1qk' style="margin-bottom: 20px;">
                <ul class="box">
                    <li><a href="/periodicalList.html"> <p class="textAll flex-a"><img  class="locatclass"  src="/image/periodical/local.png"><label class="text"> 期&nbsp; 刊</label></p></a></li>
                    <li><a href="/periodicalList.html?type=hy"> <p class="textAll flex-a"><img  class="locatclass"  src="/image/periodical/local.png"><label class="text"> 会&nbsp; 议</label></p></a></li>
                </ul>
            </div>

            
        <!-- </div> -->
        <!-- 左侧菜单 -->
        <!-- <div class="aside"> -->
            <div class="top">
                <div class="left bg_size">
                    <span>资源分类</span>
                </div>
                <div class="right">
                    <span class="select" id="all">全选</span>
                    <span class="two" id="not">取消</span>
                </div>
            </div>
            <!-- 分类导航栏菜单 -->
            <div class="asideMenu" id='asideMenu1'>
            </div>


        </div>

        
        <!-- 右侧表格 -->
        <div class="content">
            <!-- 搜索框 -->
            <div class="searchBox flex" id='search_content'>
                <!-- 搜索 -->
                <div class="searchPart flex" id='search'>
                </div>
            </div>
            <!-- 表格 -->
            <!-- <a  id="qklink" style="display: none;" href="/periodicalList.html" target="_blank"><img  class="locatclass"  src="/image/periodical/local.png"><span> 期刊及会议导航</span></a> -->
            <div class="tbHeader">
                <div class="head flex-start">
                    <span>排序：</span>
                    <ul class="flex-start">
                        <li>
                            <span class='RELEVANT'>相关性</span>
                            <div>
                                <button class="bottom" value=""></button>
                            </div>

                        </li>
                        <li>
                            <span class='发表时间'>发表时间</span>
                            <div>
                                <button class="top" value="ASC"></button>
                                <button class="bottom" value="DESC"></button>
                            </div>
                        </li>
                        <li>
                            <span class='下载频次'>下载量</span>
                            <div>
                                <button class="top" value="ASC"></button>
                                <button class="bottom" value="DESC"></button>
                            </div>
                        </li>
                    </ul>
                </div>
            </div>
            <!-- 表格数据 -->
            <div class="tableData" id='knowledgeTable'>
                <span id='KnowledgeMention' style="display: none;text-align: center;padding: 20px 0;">暂无数据</span>
                <div style="min-height: 540px;overflow: hidden;">
                    <table>
                        <script id='knowledgeTableData' type="text/html">
                    <tr>
                        <td class="one"> <span class='num'>{{:#data['num']}}</span></td>
                        <td class="two">
                            <p class="title hover" data-dbsource='{{:#data["dataSource"]}}'  data-tablename='{{:#data["tableCode"]}}' data-sysid='{{:#data["sysId"]}}'  title='{{:#data["title"]}}' data-filename='{{:#data["fileName"]}}' data-title='{{:#data["title"]}}'>{{:#data['title']}}</p>
                            <ul class="flex-wrap">
                                
                                    {{if tableCode=='YQTFZWW_METADATA'}}
                                    <li><span>发表时间：</span>
                                    <span>{{:#data['publishDate'].split(' ')[0]}},{{:#data['period']}}</span>
                                    {{else tableCode=='YQTWWQK_METADATA'}}
                                    <li><span>发表时间：</span>
                                    <span>{{:#data['pubyear']}},{{:#data['period']}}</span>
                                    {{else}}
                                    <li><span>发布时间：</span>
                                    <span>{{:#data['publishDate'].split(' ')[0]}}</span>
                                    {{/if}}
                                </li>
                                <li><span>数据来源：</span>
                                    <span class="red" title="{{:#data['dataSource']}}">{{:#data['dataSource']}} </span>
                                </li>
                                <li><span>浏览量：</span><span style="margin-right:20px;">{{:#data['browseRate']}}</span
                                    style="margin-right:5px"><span >下载量：</span><span >{{:#data['downRate']}}</span></li>
                              
                                <li style="position: absolute;right: -165px;top:0px">
                                    <ul class="flex-start" >
                                        <li class="save" style="{{:~showSave(#data,#index)}}" title="收藏" data-dbsource='{{:#data["dataSource"]}}' data-dbname='{{:#data["dataSource"]}}'  data-tablename='{{:#data["tableCode"]}}' data-sysid='{{:#data["sysId"]}}'  data-filename='{{:#data["fileName"]}}'   data-title='{{:#data["title"]}}' data-ipAddress="{{:~ipAddress(#data,#index)}}"><span class="saveImg"></span>
                                        </li>
                                        <li class="preview" style="{{:~showSave(#data,#index)}}" title="预览" data-dbsource='{{:#data["dataSource"]}}' data-dbname='{{:#data["dataSource"]}}' data-tablename='{{:#data["tableCode"]}}' data-sysid='{{:#data["sysID"]}}' data-digitfilename='{{:#data["digitFileName"]}}'><span class="previewImg"></span>
                                        </li>
                                        <li class="download"  style="{{:~showSave(#data,#index)}}"  title="下载" data-dbsource='{{:#data["dataSource"]}}'  data-dbname='{{:#data["dataSource"]}}'  data-tablename='{{:#data["tableCode"]}}'  data-dbsource='{{:#data["dbsource"]}}' data-sysid='{{:#data["sysID"]}}'  data-filename='{{:#data["fileName"]}}'  data-ipAddress="{{:~ipAddress(#data,#index)}}"  data-title='{{:#data["title"]}}' data-digitfilename='{{:#data["digitFileName"]}}'><span class="downLoadImg"></span>
                                        </li>

                                    </ul>
                                </li>
                            </ul>
                        </td>
                    </tr>
                    </script>
                        <!-- 暂无数据 -->
                    </table>
                </div>
                <!-- 分页 -->
                <div class="pageNation">
                    <div id="test1"></div>
                </div>
            </div>
        </div>
    </div>
    <!-- 脚部 -->
    <div id="footer"></div>
    <!-- 收藏弹窗 -->
    <div id='saveClassify' class='saveClassify' style="display: none;"></div>
    <script type="text/javascript">
        shared.useLayout("act-1");
        var type = base.getQueryParam('type');
        var classify= base.getQueryParam('classify');
        if (type == 'KYDA') {

            $("#asideMenu1qk").hide();
            shared.ajaxGet(config.getIpAddress,{},function(res){
                console.log(res)
              for(var u=0;u<config.ip.length;u++){
                 var flage=1;               
                if(res.indexOf(config.ip[u])==-1){
                      
                     flage=1  
                     
                    // alert('您的ip访问受限！');
                    //  location.href='/index.html'
                      //return;
                  }else{
                   // return; 
                   flage=0
                   
                  }               
              }

            //   if(flage==1){
            //        alert('您的ip访问受限！');
            //         location.href='/index.html'
            //           return;
            //   }
            })
            var menuUrl = config.getKYDASort;
            var url = config.complexSearch_kyda;
            $("#asideMenu1").load("/shared/newsMenu.html");
            function getMenu() {
                //选择选中的值
                var list = []
                $('#asideMenu1 .check').each(function (index, item) {
                    list.push($(item).parent('p').attr('data-dbcode'))
                })
                return list;
            }
        } else if (type == 'KJQB') {
            $("#asideMenu1qk").hide();
            $("#asideMenu1qk1").hide();
            var menuUrl = config.getClsTree;
            var url = config.complexSearch_qbkj;
            $("#asideMenu1").load("/shared/technolege.html");
            function getMenu() {
                //选择选中的值
                var list = []
                $('.children .check').each(function (index, item) {
                    list.push($(item).parent('p').attr('data-code'))
                })
                return list;
            }
            
        }

        else if (type == 'WWSJ') {
            $("#asideMenu1qk").show()
            var menuUrl = config.getQKKM;
            var url = config.complexSearch_wwsj;
            $("#asideMenu1").addClass('wwwx');
            $('.top .right').css('display','none')
            $("#asideMenu1").load("/shared/wwwxMenu.html");
            function getMenu() {
                //选择选中的值
                var list = []
                $('#asideMenu1 .check').each(function (index, item) {
                    list.push($(item).parent('p').attr('data-dbcode'))
                })
                return list;
            }
            
        }
    </script>

    <script type="text/javascript" src="/lib/layer-v3.1.1/layer/layer.js"></script>
    <script src="/lib/layui/layui.js"></script>
    <script>
        var postTableData = {
            searchKey: '',
            searchValue: '',
            // 当前页
            page: 1,
            // 每页显示条数
            pageSize: 20,
            orderBySort: "desc",
            orderByValue: "发表时间",
            sortArr: []
        };

        var callBackPage = function callBack(curr, limit) {
        };
        var sysId = base.getQueryParam('sysId');
        //按回车调取检索函数
        function goMultiSearch() {
            clearSort();
            postTableData.page = 1;
            // 清除排序
            postTableData.orderBySort = "",
                postTableData.orderByValue = "",
                //清除高级检索的在结果中检索
                // 如果路由有参数
                changeValue();
            pageData.tableData(url, postTableData, 'knowledgeTableData', 'test1', true, '#KnowledgeMention', render(), true, callBackPage);
        }
        function render(data, index) {
            return {
                ipAddress: function (data, index) {
                    if (data.tableCode == "YQTFZWW_METADATA") {
                     
                    }
                    else{
                        return '?sysId=' + data.sysId + '&type=2&tableCode=' + data.tableCode;
                    }
                   
                },
                showSave: function (data, index) {
                    if (data.tableCode == "YQTFZWW_METADATA") {
                        return 'display:none';
                    }
                }
            }
        }
        // 清除升序降序样式
        function clearSort() {
            $('.tbHeader button').removeClass('clickTop');
            $('.tbHeader button').removeClass('clickBottom');
        }
        $(function () { 
            var type = base.getQueryParam('type');
            if(type == 'WWSJ'){
                core.useTemplateAuto('selectArr', config.selectwwqkArr, {});
            }
            else
            {
                core.useTemplateAuto('selectArr', config.selectArr, {});
            }
           
            // 左侧导航栏数据
            shared.ajaxGet(menuUrl, {}, function callback(res) {
                if (res != null && res.length > 0) {
                    for (var i = 0; i < res.length; i++) {
                        if (res[i].child&&res[i].child.length > 0) {
                            res[i].child.sort((a, b) => a.name.localeCompare(b.name, 'zh'));
                        }
                    }
                    core.useTemplateAuto('menuData', res, {
                    showClose: function (data, index) {
                        if (data.child && data.child.length) {
                            return 'close hasChildren';
                        } else {
                            return 'noChildren'
                        }
                    }
                });
                }
                // 请求表格数据
                // 路由跳转
                if (sysId) {
                   
                    $('.asideMenu>.box .check').removeClass('check').addClass('nocheck');
                    if (classify == 'no') {
                        $('p[ data-sysid=' + sysId + ' ]').children('.nocheck').removeClass('nocheck').addClass('check');
                        $('p[ data-sysid=' + sysId + ' ]').addClass('gray')
                        //如果
                        if (type == 'KJQB') {
                            $('p[ data-sysid=' + sysId + ' ]').toggleClass('open');
                        }
                        $('p[ data-sysid=' + sysId + ' ]').next().css('display', 'block')
                        $('p[ data-sysid=' + sysId + ' ]').next().children('li').children('p').children('.nocheck').removeClass('nocheck').addClass('check');
                    } else if (classify == 'yes') {
                        $('p[ data-sysid=' + sysId + ' ]').parents('.children').siblings('p').toggleClass('open');
                        $('p[ data-sysid=' + sysId + ' ]').parents('.children').css('display', 'block')
                        $('p[ data-sysid=' + sysId + ' ]').parents('.children').siblings('p').children('.nocheck').removeClass('nocheck').addClass('check');
                        $('p[ data-sysid=' + sysId + ' ]').children('.nocheck').removeClass('nocheck').addClass('check');
                    }
                }
                changeValue();
              
               pageData.tableData(url, postTableData, 'knowledgeTableData', 'test1', true, '#KnowledgeMention', render(), true, callBackPage);
            })
            // 全选
            $('#all').click(function () {
                $('.asideMenu>.box .nocheck').removeClass('nocheck').addClass('check');
                $(this).addClass('select');
                $('#not').removeClass('select')
            })
            // 取消
            $('#not').click(function () {
                $('.asideMenu>.box .check').removeClass('check').addClass('nocheck')
                $(this).addClass('select');
                $('#all').removeClass('select');

            })
            // 点击检索事件
            $('#searchBtn').click(function () {
                goMultiSearch();
            })
            $('#knowledgeTable').click(function (e) {
                var dataDetail = {};
                dataDetail.dataSource = $(e.target).attr('data-dbname');
                dataDetail.tableCode = $(e.target).attr('data-tablename');
                dataDetail.sysId = $(e.target).attr('data-sysid');
                dataDetail.digitFileName = $(e.target).attr('data-digitfilename');
                if ($(e.target).hasClass('title')) {
                   if($(e.target).attr('data-tablename') == 'YQTFZWW_METADATA'){
                        shared.ajaxPost(config.getFZWWDMETAID, {sysId:$(e.target).attr('data-sysid'),tableCode:$(e.target).attr('data-tablename')}, function callback(res) {
                            console.log("wwfz",res)
                            pageData.toWwqk(res)
                            return
                        })
                    }
                   else if($(e.target).attr('data-tablename') == 'YQTWWQK_METADATA'){
                        window.open('/magazineDetail.html?sysId=' + $(e.target).attr('data-sysid') + '&type=2&tableCode=' + $(e.target).attr('data-tablename'),'location=yes')
                    return;
                    }
                    else{
                        window.open('/resourseDetail.html?sysId=' + $(e.target).attr('data-sysid') + '&type=2&tableCode=' + $(e.target).attr('data-tablename'))
                    return;
                    }
                  

                } else if ($(e.target).hasClass('save')) {
                    if (!shared.getCookie('token')) {
                        window.location.href = '/login.html'
                        return;
                    }
                    //内部
                    pageData.savePop('#saveClassify', 'saveDocument', 'inner', $(e.target));
                } else {
                    pageData.threePart(dataDetail, $(e.target))
                }
            })
            // 点击表格里的升序降序
            sort();
            function sort() {
                $('.tbHeader .top').click(function () {
                    postTableData.page = 1;
                    postTableData.orderBySort = $(this).val();
                    postTableData.orderByValue = $(this).parent('div').siblings('span')[0].className;

                    //加上高亮样式
                    clearSort();
                    $(this).addClass('clickTop');
                    // 请求表格数据
                    pageData.tableData(url, postTableData, 'knowledgeTableData', 'test1', true, '#KnowledgeMention', render(), true);
                })
                $('.tbHeader .bottom').click(function () {
                    postTableData.page = 1;
                    postTableData.orderBySort = $(this).val();
                    postTableData.orderByValue = $(this).parent('div').siblings('span')[0].className;
                    //加上高亮样式
                    clearSort();
                    $(this).addClass('clickBottom');
                    // 请求表格数据
                    pageData.tableData(url, postTableData, 'knowledgeTableData', 'test1', true, '#KnowledgeMention', render(), true);
                })
            }
        })
        // 获取值
        function changeValue() {
        
            postTableData.searchKey = $("#searchselect").find("option:selected").val();
            postTableData.searchValue = $("#searchWord").val();
            postTableData.sortArr = getMenu();
            if ($("#searchWord").val() && !base.patrn.test($("#searchWord").val())) {
                if (type == 'KYDA') {
                    pageData.InsertLog('科研档案', '检索', $("#searchWord").val());
                } else if (type == 'KJQB') {
                    pageData.InsertLog('', '检索', $("#searchWord").val());
                }
            }
        }
    </script>
</body>
<style>

    #asideMenu1qk .box li{
        margin-top: 26px;
    }
    #asideMenu1qk p label{
        font-size: 25px;
         font-weight: bolder;

    }
    #qklink{
        display: block;
        margin-bottom: 16px;
    }
   .locatclass{
    width: 32px;
    height: 32px;
    vertical-align: middle;
    margin-left:50px;
   }
   #qklink span{
    font-size: 18px;
    font-weight: 700;
    color: #1195e1;
   }

</style>
</html>